package com.ourfox.erp.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver;

import com.mybatis.User;
import com.ourfox.erp.exception.PortalException;

@Controller
public class TestController {

	
	//@RequestMapping(value="/index.htm")
	public void test(){
		System.out.println("------------test");
		SimpleMappingExceptionResolver s;
	}
	
	@RequestMapping(value="/index1")
	public @ResponseBody User index(){
		System.out.println("-------index");
		User user = new User();
		user.setId(1);
		user.setName("test");
		user.setPassword("111111");
		return user;
	}
	
	@RequestMapping(value="/getUser")
	public @ResponseBody User getUser(@RequestBody User user)throws Exception{
		if(user != null && user.getId() == 1){
			throw new PortalException(1500);
		}
		return user;
	} 
	
}
